ゲーム 800x450 公開中

転がりゆく玉

投稿者:ikosami 投稿日時: 2014/01/17 11:34:36
まだチュートリアルがすべて完成していません・・・
閲覧: 233 評価: 0
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
  • Starwhite
あなたはまだ評価していません。
#画面は600*450 左右に100、ずつ開ける。マスは30*30  #左右の空間は両方三等分し、真中が左右移動、右に「やり直す」「あきらめる」 game.loading do |loader| loader.add :window, :system => "window" loader.add :gui_item, :system => "gui_item" loader.add :bac, 63#背景(まだない) loader.add :space, 274#左右の空間 loader.add :br, 268#右 loader.add :bl, 267#左 loader.add :bu, 266#上 loader.add :bd, 265#下 loader.add :by, 275 loader.add :ba, 288 loader.add :ball_i, 287#ボール loader.add :map_i,297 loader.add :select,293 loader.add :ste,294 loader.add :bp,296 end #関数 Variable = {} def SV(a,b) Variable[a] = b end def GV(a) Variable[a] end game.on_init do set_window_image :window set_gui_image :gui_item speak "転がり行く玉 Ver0.9" SV(:ste,[[1,1,1,1,1,1,1,1,0,0,0], [0,0,0,1,0,0,0,0,0,0,0], [0,1,0,0,0,0,0,0,0,1,1], [0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0]]) SV(:sele,[0,0]) scene_change :select end scene :select do |scene| scene.on_init do scene.add :image, :texture => :select, :align => :fullscreen#背景の表示 #ステージ生成 y = 0 while y < 8 x = 0 while x < 11 a = scene.add :image, :template => :ste, :position => [x*50+150,y*50+50] #画像の種類 a.copy_rect GV(:ste)[y][x],0 x = x + 1 end y = y + 1 end bal = scene.add :image, :template => :ball2, :position => [(GV(:sele)[1]*50)+150,(GV(:sele)[0]*50)+50] bal.copy_rect rand(2), 0 space = scene.add :collision, :texture =>:space, :position => [0, 0], :scale => [1.0, 1.0] #上.左右.下.設定.決定 bu = scene.add :image, :texture =>:bu, :position => [0, 0], :scale => [1.0, 1.0] bl = scene.add :image, :texture =>:bl, :position => [0, 150], :scale => [1.0, 1.0] bd = scene.add :image, :texture =>:bd, :position => [0, 300], :scale => [1.0, 1.0] bp = scene.add :image, :texture =>:bp, :position => [700, 0], :scale => [1.0, 1.0] br = scene.add :image, :texture =>:br, :position => [700, 150], :scale => [1.0, 1.0] ba = scene.add :image, :texture =>:ba, :position => [700, 300], :scale => [1.0, 1.0] mx = 0 my = 0 bu.event :on_touch_down do |event| mx = 0 my = -1 end bl.event :on_touch_down do |event| mx = -1 my = 0 end bd.event :on_touch_down do |event| mx = 0 my = 1 end br.event :on_touch_down do |event| mx = 1 my = 0 end bp.event :on_touch_down do |event| scene_change :Setting end ba.event :on_touch_down do |event| game.change_project "start_menu" end space.event :on_step do |event| if mx == 0 && my == 0 else a = 1 GV(:sele)[0] += my GV(:sele)[1] += mx #画面外には落ちない if GV(:sele)[0] > 7 || GV(:sele)[0] < 0 || GV(:sele)[1] > 10 || GV(:sele)[1] < 0 GV(:sele)[0] -= my GV(:sele)[1] -= mx end bal.set_data :x, GV(:sele)[1]*50+150 bal.set_data :y, GV(:sele)[0]*50+50 bal.change_motion :move mx = 0 my = 0 end end end end #ball x,y,色,状態,動いたか,壁に乗ったか scene :Setting do |scene| SV(:ball_i,[1,1]) SV(:k,0) if GV(:sele)[0] == 0 if GV(:sele)[1] == 0 speak "このゲームは、玉を転がしてゴールへ導くパズルゲームです。" speak "左右上下のボタンを押すと、すべての玉がすべて同時に動きます。" speak "玉の上にある柄の地面がゴールです。" SV(:k,2) SV(:ball,[[7, 7, 0, 0 ,0, 0],[9, 7, 1, 0, 0, 0]]) SV(:map,[[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00, 9,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00, 8,00,01,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,01,00,01,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,01,00,01,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]]) elsif GV(:sele)[1] == 1 speak "そのまま進むと玉が落ちてしまって\nクリアができないときは" speak "壁に引っ掛けて2つの玉の距離を変えれば通ることができます。" SV(:k,2) SV(:ball,[[4, 7, 0, 0 ,0, 0],[7, 7, 1, 0, 0, 0]]) SV(:map,[[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00, 9,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00, 8,00,01,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,01,00,01,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,01,01,01,01,01,01,01,02,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]]) elsif GV(:sele)[1] == 2 speak "色のついた床は、\n同じ色の玉しか通れません" speak "色の違う玉は落ちてしまうので、\n通ろうとしてはいけません。" SV(:k,2) SV(:ball,[[4, 7, 0, 0 ,0, 0],[7, 7, 1, 0, 0, 0]]) SV(:map,[[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,04,04,04, 9,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,04, 8,05,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,04,01,05,02,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,01,01,01,01,01,01,01,02,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]]) elsif GV(:sele)[1] == 3 speak "小さくて四角いのはスイッチです。" speak "スイッチを押すと、一部の壁・床・空間が変化します" SV(:k,2) SV(:ball,[[5, 7, 0, 0 ,0, 0],[8, 7, 1, 0, 0, 0]]) SV(:map,[[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00, 8,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,02,02,02,01,02,02,02,02,00,00,00,00,00,00,00,00], [00,00,00,00,01,01,01,26,01,01,01,23, 9,00,00,00,00,00,00,00], [00,00,00,00,02,02,02,01,14,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]]) elsif GV(:sele)[1] == 4 speak "一つの玉がスイッチを押したとき、\n壁に変形する場所に玉があると" speak "玉が壁の上に乗ることができ、\nそのまま壁に乗って隣の壁に移動できます。" SV(:k,2) SV(:ball,[[7, 6, 0, 0 ,0, 0],[10, 7, 1, 0, 0, 0]]) SV(:map,[[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00, 8,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00, 2,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,02,02,02,23,02,02,02,02,00,00,00,00,00,00,00,00], [00,00,00,00,01,01,01,01,01,14,01,24, 9,00,00,00,00,00,00,00], [00,00,00,00,02,02,02,01,01,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]]) elsif GV(:sele)[1] == 5 speak "玉が棘にぶつかると、\nその玉は消えてしまいます。" speak "ですが、緑の玉をぶつけると\n逆に棘を消すことができます。" SV(:k,2) SV(:ball,[[5, 7, 0, 0 ,0, 0],[8, 7, 1, 0, 0, 0]]) SV(:map,[[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00, 8,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00, 2,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,02,02,02,23,02,02,02,02,00,00,00,00,00,00,00,00], [00,00,00,02,01,01,15,15,01,14,01,24, 9,00,00,00,00,00,00,00], [00,00,00,00,02,02,02,01,01,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]]) elsif GV(:sele)[1] == 6 speak "ボロい床は一度通ると穴が開き,\nボロい壁は普通の床になります。" speak "青い球は穴をあけずに通れます。" speak "なお、今回出てくる茶色のゴールは\nすべての玉がゴール可能です。" SV(:k,3) SV(:ball,[[5, 6, 0, 0 ,0, 0],[7, 8, 1, 0 ,0, 0],[8, 7, 2, 0, 0, 0]]) SV(:map,[[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,13,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,18,18,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,02,02,02,24,17,02,02,02,00,00,00,00,00,00,00,00], [00,00,00,00,01,15,15,15,17,14,01,02,00,00,00,00,00,00,00,00], [00,00,00,00,01,01,01,01,01,01,02,00,00,00,00,00,00,00,00,00], [00,00,00,00,01,01,01,01,01,01,02,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]]) elsif GV(:sele)[1] == 7 speak "氷の地面はすべります。\n赤い球は穴を氷を溶かすことができます。" speak "滑らせてクリアに導くこともあるので\nすぐに溶かさないほうがいいです" SV(:k,3) SV(:ball,[[5, 6, 0, 0 ,0, 0],[7, 8, 1, 0 ,0, 0],[8, 7, 2, 0, 0, 0]]) SV(:map,[[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,15,13,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,02,01,01,19,19,02,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,01,01,19,19,19,02,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,01,01,01,01,01,01,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,01,01,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]]) elsif GV(:sele)[1] == 8 speak "壁の上に棘があることや、\n壁の上が滑るものがあります。" speak "滑る氷壁は氷の壁と\n壁が凍ったものがあます。" speak "氷壁は赤玉で溶かすと床になり\n凍った壁は溶かすと壁になります" SV(:k,2) SV(:ball,[[5, 6, 0, 0 ,0, 0],[5, 7, 1, 0 ,0, 0]]) SV(:map,[[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,13,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,02,02,20,28,24,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,02,02,20,28,24,14,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]]) end elsif GV(:sele)[0] == 1 if GV(:sele)[1] == 3 SV(:k,3) SV(:ball,[[7, 4, 0, 0 ,0, 0],[9, 6, 0, 0, 0, 0],[8, 9, 0, 0, 0, 0]]) SV(:map,[[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,01,01, 8,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,01,00,02,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,01,01,01,01,01,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,01,01,01,00,01,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,01,00,01,01,01,02,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,01,01,02,01,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,01,00,01,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,01,01,01,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]]) end elsif GV(:sele)[0] == 2 if GV(:sele)[1] == 1 SV(:k,3) SV(:ball,[[7, 2, 0, 0 ,0, 0],[6, 7, 1, 0, 0, 0],[7, 7, 2, 0, 0, 0]]) SV(:map,[[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,03,03,03,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,03,24,01,24,03,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,03,24,23,24,03,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,02, 8,02,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,03,24,14, 9,14,24,03,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,24,14,00,14,24,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,23,14,14,14,23,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,23,24,23,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,04,00,24,23,24,00,04,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,04,04,10,04,04,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]]) elsif GV(:sele)[1] == 9 SV(:k,2) SV(:ball,[[9, 7, 1, 0 ,0, 0],[9, 9, 2, 0, 0, 0]]) SV(:map,[[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,24,23, 9,23,24,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,23,14,23,14,23,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,02,02,23,02,23,02,02,00,00,00,00,00,00,00], [00,00,00,00,00,00,02,24,24,04,24,24,02,00,00,00,00,00,00,00], [00,00,00,00,00,00,02,01,24,05,24,01,02,00,00,00,00,00,00,00], [00,00,00,00,00,00,02,14,01,23,01,14,02,00,00,00,00,00,00,00], [00,00,00,00,00,00,02,02,02,01,02,02,02,00,00,00,00,00,00,00], [00,00,00,00,00,00,02,02,01,01,01,02,02,00,00,00,00,00,00,00], [00,00,00,00,00,00,02,00,00,00,00,00,02,00,00,00,00,00,00,00], [00,00,00,00,00,00,02,02,02,10,02,02,02,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]]) elsif GV(:sele)[1] == 10 SV(:k,2) SV(:ball,[[9,6,1,0,0,0],[9,9,0,0,0,0]]) SV(:map,[[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,04,04,04,04,04,04,04,00,00,00,00,00,00,00], [00,00,00,00,00,00,02,03,03, 9,03,03,02,00,00,00,00,00,00,00], [00,00,00,00,00,00, 8, 5, 5,23, 5, 5, 8,00,00,00,00,00,00,00], [00,00,00,00,00,00,02,02,23,14,23,02,02,00,00,00,00,00,00,00], [00,00,00,00,00,00,23,05,01,23,01,05,23,00,00,00,00,00,00,00], [00,00,00,00,00,00,14,05,01,01,01,05,14,00,00,00,00,00,00,00], [00,00,00,00,00,00,01,05,01,01,01,05,01,00,00,00,00,00,00,00], [00,00,00,00,00,00,01,24,01,14,01,24,01,00,00,00,00,00,00,00], [00,00,00,00,00,00,01,23,05,01,05,23,01,00,00,00,00,00,00,00], [00,00,00,00,00,00, 9,01,01,01,01,01, 9,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00], [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]]) end #elsif GV(:sele)[0] == 3 end if GV(:k) == 0 speak "ここのステージはまだありません" scene_change :select end SV(:map_i,[[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) scene.add :image, :texture => :bac, :align => :fullscreen#背景の表示 scene_change :main end xx = 0 yy = 0 # メイン scene :main do |scene| scene.on_init do wall = [] wak = 0 #ステージ生成 y = 0 while y < 15 x = 0 while x < 20 if GV(:map)[y][x] != 0 GV(:map_i)[y][x] = scene.add :image, :template => :map, :position => [x*30+100,y*30] #画像の種類 GV(:map_i)[y][x].copy_rect GV(:map)[y][x]-1,1 a = GV(:map)[y][x] if a == 23 || a == 24 || a == 25 || a == 26 wall.push([x,y]) wak += 1 end end x = x + 1 end y = y + 1 end #玉画像生成,玉設定 k = GV(:k) i = 0 while i < k GV(:ball_i)[i] = scene.add :image, :template => :ball, :position => [(GV(:ball)[i][0]*30)+100,(GV(:ball)[i][1]*30)] GV(:ball_i)[i].copy_rect GV(:ball)[i][2], 0 i = i + 1 end gk = 0#ゴールした玉数 nk = 0#なくなった玉数 mx = 0 my = 0 scene.add :image, :texture => :bac, :align => :fullscreen#背景の表示 space = scene.add :collision, :texture =>:space, :position => [0, 0], :scale => [1.0, 1.0] #上.左右.下.やり直す.あきらめる bu = scene.add :image, :texture =>:bu, :position => [0, 0], :scale => [1.0, 1.0] bl = scene.add :image, :texture =>:bl, :position => [0, 150], :scale => [1.0, 1.0] bd = scene.add :image, :texture =>:bd, :position => [0, 300], :scale => [1.0, 1.0] by = scene.add :image, :texture =>:by, :position => [700, 0], :scale => [1.0, 1.0] br = scene.add :image, :texture =>:br, :position => [700, 150], :scale => [1.0, 1.0] ba = scene.add :image, :texture =>:ba, :position => [700, 300], :scale => [1.0, 1.0] t = scene.text :position => [105, 5] t.set_text_area_size 300, 332 t.set_font_point_size 28 t.set_color 0, 0, 0, 255 t.set_text "転がり行く玉" te = "転がり行く玉" bu.event :on_touch_down do |event|#上 mx = 0 my = -1 end bl.event :on_touch_down do |event|#左 mx = -1 my = 0 end bd.event :on_touch_down do |event|#下 mx = 0 my = 1 end br.event :on_touch_down do |event|#右 mx = 1 my = 0 end by.event :on_touch_down do |event| scene_change :Setting end ba.event :on_touch_down do |event| scene_change :select end space.event :on_step do |event| if mx == 0 && my == 0 else swi = false i = 0 mbx = [0,0] mby = [0,0] while i < k sb = false#滑ったかどうか if GV(:ball)[i][4] != -1 b = GV(:map)[GV(:ball)[i][1]][GV(:ball)[i][0]] if b == 2|| b == 18 || b == 20 || b == 24 || b == 28 GV(:ball)[i][5] = 1#壁に乗っている else GV(:ball)[i][5] = 0 end mbx[i] = GV(:ball)[i][0] mby[i] = GV(:ball)[i][1] GV(:ball)[i][0] += mx GV(:ball)[i][1] += my GV(:ball)[i][3] = 1#動いた #画面外には落ちない if GV(:ball)[i][0] > 19 || GV(:ball)[i][0] < 0 || GV(:ball)[i][1] > 14 || GV(:ball)[i][1] < 0 GV(:ball)[i][0] -= mx GV(:ball)[i][1] -= my end a = GV(:map)[GV(:ball)[i][1]][GV(:ball)[i][0]] if a == 0 || (2 < a && a < 8) || a == 26 g = a-3 if g != GV(:ball)[i][2] || a == 0 || a == 26 GV(:ball)[i][4] = -1 te = te + "\n玉" + (i+1).to_s + ":落下" nk = nk + 1 end elsif 7 < a && a < 14 g = a-8 if g == GV(:ball)[i][2] || a == 13 GV(:ball)[i][4] = -1 te = te + "\n玉" + (i+1).to_s + ":ゴール" gk = gk + 1 end elsif a == 15 || a == 16 if GV(:ball)[i][2] == 1 GV(:map)[GV(:ball)[i][1]][GV(:ball)[i][0]] = 1 GV(:map_i)[GV(:ball)[i][1]][GV(:ball)[i][0]].copy_rect 0,1 else GV(:ball)[i][4] = -1 te = te + "\n玉" + (i+1).to_s + ":棘接触" nk = nk + 1 end elsif a == 14 swi = true elsif a == 19 || a == 20 || a == 28#滑る床 if GV(:ball)[i][2] == 0 if a == 19 || a == 20 GV(:map)[GV(:ball)[i][1]][GV(:ball)[i][0]] = 1 GV(:map_i)[GV(:ball)[i][1]][GV(:ball)[i][0]].copy_rect 0,1 elsif a == 28 GV(:map)[GV(:ball)[i][1]][GV(:ball)[i][0]] = 2 GV(:map_i)[GV(:ball)[i][1]][GV(:ball)[i][0]].copy_rect 1,1 end else sb = true i = i - 1 end end #壁 if (a == 2|| a == 18 || b == 20 || a == 24 || b == 28) && GV(:ball)[i][5] == 0 && !sb GV(:ball)[i][0] -= mx GV(:ball)[i][1] -= my GV(:ball)[i][3] = 0 end end i = i + 1 end i = 0 while i < k #球の重なり判定 lop = true while lop i2 = 0 lop = false while i2 < k i3 = 0 while i3 < k if GV(:ball)[i2][0] == GV(:ball)[i3][0] && GV(:ball)[i2][1] == GV(:ball)[i3][1] && GV(:ball)[i2][3] == 1 if i2 != i3 GV(:ball)[i2][0] -= mx GV(:ball)[i2][1] -= my GV(:ball)[i2][3] = 0 lop = true end end i3 = i3 + 1 end i2 = i2 + 1 end end i = i + 1 end i = 0 while i < k if GV(:ball)[i][3] == 1 && GV(:ball)[i][2] != 2 if GV(:map)[mby[i]][mbx[i]] == 17 GV(:map)[mby[i]][mbx[i]] = 0 GV(:map_i)[mby[i]][mbx[i]].copy_rect GV(:map)[mby[i]][mbx[i]]-1,1 elsif GV(:map)[mby[i]][mbx[i]] == 18 GV(:map)[mby[i]][mbx[i]] = 1 GV(:map_i)[mby[i]][mbx[i]].copy_rect GV(:map)[mby[i]][mbx[i]]-1,1 end end i += 1 end mx = 0 my = 0 #スイッチ if swi i2 = 0 while i2 < wak x = wall[i2][0] y = wall[i2][1] if GV(:map)[y][x] == 24 GV(:map)[y][x] = 23 elsif GV(:map)[y][x] == 23 GV(:map)[y][x] = 24 elsif GV(:map)[y][x] == 25 GV(:map)[y][x] = 26 i3 = 0 while i3 < k if GV(:ball)[i3][1] == y && GV(:ball)[i3][0] == x GV(:ball)[i][0] = -1 te = te + "\n玉" + (i+1).to_s + ":落下" nk = nk + 1 end i3 += 1 end elsif GV(:map)[y][x] == 26 GV(:map)[y][x] = 25 end GV(:map_i)[y][x].copy_rect GV(:map)[y][x]-1,1 i2 = i2 + 1 end end #移動 i = 0 while i < k xx = GV(:ball)[i][0]*30+100 yy = GV(:ball)[i][1]*30 GV(:ball_i)[i].set_data :x, xx GV(:ball_i)[i].set_data :y, yy if GV(:ball)[i][4] != -1 GV(:ball_i)[i].change_motion :move else GV(:ball_i)[i].change_motion :move2 GV(:ball)[i][0] = -1 GV(:ball)[i][1] = -1 end i = i + 1 end end#動きここまで if gk == GV(:k) speak "クリア!" scene_change :select elsif nk > 0 speak "ゲームオーバー" scene_change :Setting end t.set_text te.to_s end end end sprite_template :ball do |st| st.texture :ball_i st.src_size 30, 30 st.dest_size 30, 30 st.center_offset 30, 30 st.layer_order 10 st.copy_rect 0, 0 # キャラモーション st.motion :move do |commands| commands.loop false commands.move_to(lambda do |st| st.get_data :x end, lambda do |st| st.get_data :y end, 5) commands.wait_motion end st.motion :move2 do |commands| commands.loop false commands.move_to(lambda do |st| st.get_data :x end, lambda do |st| st.get_data :y end, 5) commands.wait_motion commands.proc_call do |st| st.delete end end end #選択肢のボール sprite_template :ball2 do |st| st.texture :ball_i st.src_size 30, 30 st.dest_size 50, 50 st.center_offset 30, 30 st.layer_order 10 st.copy_rect 0, 0 # キャラモーション st.motion :move do |commands| commands.loop false commands.move_to(lambda do |st| st.get_data :x end, lambda do |st| st.get_data :y end, 5) commands.wait_motion end end sprite_template :map do |st| st.texture :map_i st.src_size 30, 32 st.dest_size 30, 32 st.center_offset 30, 30 st.layer_order 10 st.copy_rect 0, 0 end sprite_template :ste do |st| st.texture :ste st.src_size 50, 50 st.dest_size 50, 50 st.center_offset 30, 30 st.layer_order 10 st.copy_rect 0, 0 end
コード一覧
  • start.rb

コメントするには、ログインする必要があります。

コメント一覧
お知らせ

2014/03/04 ver. 0.1.39 を公開しました!
・0.1.36でWindowsで起動しない問題を修正しました
(Android版はバージョン番号のみの変更です。)

2014/03/04 ver. 0.1.36 を公開しました!
・アプリケーションアイコンを変更しました
・セーブ・ロードを繰り返すとアプリが強制終了する問題を修正しました
・他、重大なバグを修正しました

ダウンロードはこちらから。

2013/07/17 Code on Rmakeをα公開しました!